{% extends "base.html" %}
{% block title %}Login{% endblock %}
{% block content %}

{% if user.is_anonymous %}

	{% if form.errors %}
	<p>Your username and password didn't match. Please try again.</p>
	{% endif %}
	<form method="post" action="{% url 'login' %}" class='form'>{% csrf_token %}
	<table>
	<tr>
		<td>{{ form.username.label_tag }}</td>
		<td>{{ form.username }}</td>
	</tr>
	<tr>
		<td>{{ form.password.label_tag }}</td>
		<td>{{ form.password }}</td>
	</tr>
	</table>
	<p>Need an account? <a href="{% url 'register' %}">Register</a> now</p>
	<input type="hidden" name="next" value="{{ next }}" />
	<input type="submit" value="login" />
	</form>
{% else %}
      <a href="{% url 'logout' %}">logout</a>
{% endif %}

{% endblock %}
